<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增团队采购政策')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-policy-add">
        <input type="hidden" name="type" value="2">
        <div class="form-group">
            <label class="col-sm-3 control-label">采购政策编号：</label>
            <div class="col-sm-8">
                <input name="policyId" class="form-control" readonly th:value="${policyId}" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">政策名称：</label>
            <div class="col-sm-8">
                <input name="policyName" required class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">政策比例：</label>
            <div class="col-sm-8">
                <input name="policyValue" required onkeyup="value=value.replace(/[^\d^\.]+/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">开始采购机器(台数)：</label>
            <div class="col-sm-8">
                <input name="policyCondition" required onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">结束采购机器(台数)：</label>
            <div class="col-sm-8">
                <input name="policyConditionEnd" required onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">状态：</label>
            <div class="col-sm-8">
                <select name="status" class="form-control m-b" required>
                    <option value="1">正常</option>
                    <option value="0">关闭</option>
                </select>
            </div>
        </div>
        <div class="form-group" style="display: none">
            <label class="col-sm-3 control-label">团类型：</label>
            <div class="col-sm-8">
                <select name="teamType" class="form-control m-b" style="display: none">
                    <option value="1">老团</option>
                    <option value="2">新团</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">开始日期：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <input name="startDate" required readonly class="form-control" placeholder="yyyy-MM-dd" type="text">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">结束日期：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <input name="endDate"  required readonly class="form-control" placeholder="yyyy-MM-dd" type="text">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                </div>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
    var prefix = ctx + "team/policy"
    $("#form-policy-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/add", $('#form-policy-add').serialize());
        }
    }


    $("input[name='startDate']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $("input[name='endDate']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });



</script>
</body>
</html>